<template>
  <div>
    <!-- 数据展示-->
    <el-row :gutter="20">
      <el-col :span="6">
        <el-card class="shu">
          <el-row :gutter="10" justify="space-between">
            <el-col :span="8">
              <img style="width:50px" src="/src/assets/yonghu.png">
            </el-col>
            <el-col :span="14">
              <el-statistic title="总用户数" :value="268500" />
            </el-col>
          </el-row>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card class="shu">
          <el-row :gutter="20" justify="space-between">
            <el-col :span="8">
              <img style="width:50px" src="/src/assets/kaoshi.png">
            </el-col>
            <el-col :span="10">
              <el-statistic title="创建考试数量" :value="123456" />
            </el-col>
          </el-row>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card class="shu">
          <el-row :gutter="20" justify="space-between">
            <el-col :span="8">
              <img style="width:50px" src="/src/assets/tijiao.png">
            </el-col>
            <el-col :span="10">
              <el-statistic title="考生总提交数" :value="138"/>
            </el-col>
          </el-row>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card class="shu">
          <el-row :gutter="20" justify="space-between">
            <el-col :span="8">
              <img style="width:50px" src="/src/assets/tiku.png">
            </el-col>
            <el-col :span="10">
              <el-statistic title="题库题目数量" :value="172000" />
            </el-col>
          </el-row>
        </el-card>
      </el-col>
    </el-row>
    <!-- 图表-->
    <el-row :gutter="20" style="margin-top: 20px">
      <el-col :span="12">
        <el-card>
          <template #header>
            <div>
              <span><el-icon><DataAnalysis /></el-icon> &nbsp;&nbsp;近10天考试提交次数</span>
            </div>
          </template>
            <div ref="echarts" style="height: 400px;">
            </div>
        </el-card>
      </el-col>
      <el-col :span="12">
        <el-card>
          <template #header>
            <div>
              <span><el-icon><Memo /></el-icon> &nbsp;&nbsp;我创建的考试</span>
            </div>
          </template>
          <div style="height: 400px;">
            <el-empty description="您还没有创建考试" />
          </div>
        </el-card>
      </el-col>
    </el-row>
    <!-- 提交信息-->
    <el-row :gutter="20" style="margin-top: 20px;">
      <el-col :span="18">
        <el-card>
          <template #header>
            <div>
              <span><el-icon><Calendar /></el-icon> &nbsp;&nbsp;当前提交信息监控</span>
            </div>
          </template>
          <div style="height: 400px;" >
            <el-empty description="暂无提交数据" />
          </div>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card>
          <template #header>
            <div>
              <span><el-icon><DataLine /></el-icon> &nbsp;&nbsp;当前服务器状态监控</span>
            </div>
          </template>
          <div style="height: 400px;" >
            <el-empty description="暂时无法获取状态" />
          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import * as echarts from 'echarts';

export default {
  name: "Home",
  data(){
    return{

    }
  },
  mounted(){
    this.getSubmitNum();
  },
  methods:{
    getSubmitNum(){
      const dom = this.$refs.echarts
      const chart = echarts.init(dom);
      let option = {
        color: '#409EFF',
        xAxis: {
          type: 'category',
          data: [
            '12-24',
            '12-25',
            '12-26',
            '12-27',
            '12-28',
            '12-29',
            '12-30',
            '12-31',
            '01-01',
            '01-02'
          ]
        },
        yAxis: {
          type: 'value'
        },
        series: [
          {
            data: [120, 200, 150, 80, 70, 110, 130, 150, 120, 113],
            type: 'bar'
          }
        ]
      };
      option && chart.setOption(option);
    }
  }
}
</script>

<style scoped>
  .shu{
    padding: 0 30px;
  }
</style>
